package com.taotao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.EasyUIDataGridResult;
import com.taotao.common.pojo.TaotaoResult;
import com.taotao.content.service.ContentService;
import com.taotao.pojo.TbContent;

@Controller
public class ContentController {
	@Autowired
	private ContentService contentService;
	@RequestMapping("/content/query/list")
	@ResponseBody
	public EasyUIDataGridResult getContentList(Integer page,Integer rows,Long categoryId){
		EasyUIDataGridResult contentList = contentService.getContentList(categoryId, page, rows);
		return contentList;
	}
	
	@RequestMapping("/content/save")
	@ResponseBody
	public TaotaoResult insertContent(TbContent tbContent){
		TaotaoResult taotaoResult = contentService.insertContent(tbContent);
		return taotaoResult;
	}
	
	@RequestMapping("/content/delete")
	@ResponseBody
	public TaotaoResult delContentList(String ids){
		TaotaoResult taotaoResult = contentService.delContentList(ids);
		return taotaoResult;
	}
	
	@RequestMapping("/rest/content/edit")
	@ResponseBody
	public TaotaoResult updateContent(TbContent tbContent){
		TaotaoResult taotaoResult = contentService.updateContent(tbContent);
		return taotaoResult;
	}
	
	@RequestMapping("/rest/content/query/content/desc/{id}")
	@ResponseBody
	public TaotaoResult getContentContent(@PathVariable("id") Long id){
		TaotaoResult taotaoResult = contentService.getContentContent(id);
		return taotaoResult;
	}
}
